package com.currency.mall.ui.my.capital;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;

import com.currency.mall.R;
import com.currency.mall.ui.main.order.OrderStatusFragment;
import com.mifengs.commonbase.base.BaseActivity;
import com.mifengs.commonbase.util.StatusBarCompat;
import com.mifengs.commonbase.util.StatusBarUtils;
import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItem;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/12/24.
 */

public class CapitalListActivity extends BaseActivity {
    @BindView(R.id.stlayout_order)
    SmartTabLayout stlayoutOrder;
    @BindView(R.id.vp_capital_list)
    ViewPager vpCapitalList;
    private String[] str = new String[]{"全部", "收入", "支出"};

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_capital_list);
        ButterKnife.bind(this);
        StatusBarCompat.setStatusBarColor(this, ContextCompat.getColor(getContext(), R.color.title_color));
        StatusBarUtils.StatusBarLightMode(this);
        init();
    }

    private void init() {
        FragmentPagerItems pages = new FragmentPagerItems(getContext());
        for (String titleResId : str) {
            pages.add(FragmentPagerItem.of(titleResId, CapitalDetailsFragment.class));
        }
        FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(getSupportFragmentManager(), pages);
        vpCapitalList.setAdapter(adapter);
        vpCapitalList.setCurrentItem(0);
        vpCapitalList.setOffscreenPageLimit(3);
        stlayoutOrder.setViewPager(vpCapitalList);
    }

    @OnClick(R.id.tv_title)
    public void onViewClicked() {
        finish();
    }
}
